package org.vaadin.golfscoretracker.ui.views;

import org.vaadin.appfoundation.i18n.Lang;
import org.vaadin.appfoundation.i18n.TranslationUtil;
import org.vaadin.golfscoretracker.data.RoundSet;
import org.vaadin.golfscoretracker.ui.components.RoundSetFieldFactory;
import org.vaadin.golfscoretracker.ui.controller.RoundController;

import com.vaadin.ui.FormFieldFactory;

public class RoundsView extends AbstractDataEditorView<RoundSet> {

    private static final long serialVersionUID = 3351949173858273198L;

    public RoundsView() {
        super(new RoundController());
    }

    @Override
    protected FormFieldFactory getFormFieldFactory() {
        return new RoundSetFieldFactory();
    }

    @Override
    protected Object[] getVisibleItemProperties() {
        return new Object[] { "date", "course", "rounds" };
    }

    @Override
    protected void setTableHeaders() {
        table.setColumnHeader("date", TranslationUtil.getFieldTranslation(
                RoundSet.class, "date"));
        table.setColumnHeader("course", TranslationUtil.getFieldTranslation(
                RoundSet.class, "course"));
        table.setColumnHeader("players", Lang.getMessage("round players"));

    }

}
